package com.geekstudy.week4.thread;

public class ThreadDemo2 extends Thread{

    @Override
    public void run() {
        try {
            Thread.sleep(500);
        } catch(Exception e) {
            e.printStackTrace();
        }

        Thread currentThread = Thread.currentThread();
        String threadName = currentThread.getName();
        System.out.println("线程 ThreadDemo2 " + threadName);



        System.out.println(threadName + " 线程组中活动线程数量:" + currentThread.getThreadGroup().activeCount());
        System.out.println(threadName + " 标识:" + currentThread.getId()
                + " 优先级:" + currentThread.getPriority()
                + " 状态:" + currentThread.getState()
                + " 线程组:" + currentThread.getThreadGroup()
                + " 是否活跃:" + currentThread.isAlive()
                + " 是否守护线程:" + currentThread.isDaemon());


    }
}
